import Vue from 'vue'
import VueRouter from 'vue-router'

const DiscoverMusic = () => import('@/views/DiscoverMusic')
const MyMusic = () => import('@/views/MyMusic')
const Friend = () => import('@/views/Friend')
const Market = () => import('@/views/Market')
const Download = () => import('@/views/Download')
const Recommend = () => import('@/views/Recommend')
const LeaderBoard = () => import('@/views/Discover/LeaderBoard')
const SongList = () => import('@/views/Discover/SongList')
const AnchorStation = () => import('@/views/Discover/AnchorStation')
const Singer = () => import('@/views/Discover/Singer')
const NewDiscsOnShelves = () => import('@/views/Discover/NewDiscsOnShelves')

Vue.use(VueRouter)

const routes = [
    {path: '/', redirect: '/discover/recommend'},//重定向到discover/recommend即发现音乐中的推荐页面
    {
        path: '/discover', name: 'Discover', component: DiscoverMusic, children: [
            {path: 'recommend', name: 'Recommend', component: Recommend},
            {path: 'leaderboard', name: 'LeaderBoard', component: LeaderBoard},
            {path: 'songlist', name: 'SongList', component: SongList},
            {path: 'anchorstation', name: 'AnchorStation', component: AnchorStation},
            {path: 'singer', name: 'Singer', component: Singer},
            {path: 'newdiscsonshelves', name: 'NewDiscsOnShelves', component: NewDiscsOnShelves},
        ]
    },
    {path: '/mymusic', name: 'MyMusic', component: MyMusic},
    {path: '/friend', name: 'Friend', component: Friend},
    {path: '/market', name: 'Market', component: Market},
    {path: '/download', name: 'Download', component: Download},

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
